package nc.appcan.sppub.pub;

import java.lang.reflect.Field;

public class BeanUtil<K,T> {
	
	public T beantobean(K from ,T to) {
		Field[]   filed = 	to.getClass().getDeclaredFields();
		 for(Field f:filed){
		   try {
			   f.setAccessible(true);
			  Field fr = from.getClass().getDeclaredField(f.getName());
			  if(fr==null)continue;
			  fr.setAccessible(true);
			  if(fr.get(from)==null) continue;	  
				f.set(to, fr.get(from));
		} catch (Exception e) {
		}
		 }
		return to;
	}

}
